﻿using MahApps.Metro.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Security;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Login.xaml
    /// </summary>
    public partial class Login : MetroWindow
    {
        static string Username;
        static string Password;
        public Login()
        {
            InitializeComponent();
        }

        private void Aanmelden_Click(object sender, RoutedEventArgs e)
        {
            Username = txtUsername.Text;
            Password = txtPassword.Password;

             if (Membership.ValidateUser(Username, Password))
            {
                if (Roles.IsUserInRole(Username, "Administrator"))
                {
                   
                    BedrijvenToevoegen Home = new BedrijvenToevoegen();
                    Home.Show();
                    this.Close();
                }
                else if (Roles.IsUserInRole(Username, "User"))
                {
                    MessageBox.Show("Ingelogd als User");
                }
            }
            else
            {
                MessageBox.Show("Foute login");
                txtPassword.Password = "";
                txtUsername.Text = "";
            }
        }
    }
}
